#ifndef PLUGINMODEL_H
#define PLUGINMODEL_H

#include <QAbstractTableModel>

class PluginManager;
class PluginModelPrivate;
class PluginModel : public QAbstractTableModel {
  Q_OBJECT

public:
  enum Column { Column_Name, Column_Loaded, Column_Version, Column_Author };
#define PLUGINMODEL_MAX_COLUMN PluginModel::Column_Author
  explicit PluginModel(const PluginManager *const, QObject * = nullptr);
  ~PluginModel();

  // Header:
  QVariant headerData(int section, Qt::Orientation orientation,
                      int role = Qt::DisplayRole) const override;

  // Basic functionality:
  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
  int columnCount(const QModelIndex &parent = QModelIndex()) const override;

  Qt::ItemFlags flags(const QModelIndex &index) const override;

  QVariant data(const QModelIndex &index,
                int role = Qt::DisplayRole) const override;

  bool setData(const QModelIndex &index, const QVariant &value,
               int role) override;

private:
  class PluginModelPrivate *const d_ptr;
  Q_DECLARE_PRIVATE(PluginModel)
};

#endif // PLUGINMODEL_H
